#include"Stack.h"
void test01()
{
	ST s;
	STInit(&s);
	STPush(&s,1);
	STPush(&s, 2);
	STPush(&s, 3);
	STPush(&s, 4);
	/*STPop(&s);
	STPop(&s);
	STPop(&s);
	STPop(&s);*/
	while (s.top)
	{
		printf("%d\n", STTop(&s));
		STPop(&s);
	}
	STDestroy(&s);
}
bool test02(char* s)
{
	
	ST st;
	STInit(&st);
	while (*s)
	{
		if (*s == '(' || *s == '{' || *s == '[')
		{
			STPush(&st, *s);
		}
		else
		{
			if (STEmpty(&st))
				return false;
			char top = STTop(&st);
			STPop(&st);
			if ((top == '(' && *s != ')') ||
				(top == '{' && *s != '}') ||
				(top == '[' && *s != ']'))
			{
				return false;
			}
		}
		++s;
	}
	if (st.top != 0)
		return false;
	STDestroy(&st);
	return true;
}
int main()
{
	//test01();
	char arr[1000] = "}";
		test02(arr);
		if (test02(arr) != NULL)
		{
			printf("true\n");
		}
		else {
			printf("false\n");
		}
	return 0;
}